/*!
\copyright  Copyright (c) 2023-2024 Qualcomm Technologies International, Ltd.\n
            All Rights Reserved.\n
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file       
\addtogroup event_bus
\ingroup    common
\brief      Sniffer API for the Event Bus
            The Event Bus component is provided for the centralized distribution of events throughout the system, 
            decoupling event publishers from their subscribers.  
@{
*/  
#ifndef EVENT_BUS_SNIFFER_H
#define EVENT_BUS_SNIFFER_H

#include "event_bus_subscribe.h"

typedef void (*event_bus_sniffer_handler_t)(event_bus_channel_t channel, event_bus_event_t event, void * data, uint16 data_size);

/*! \brief Registers the sniffing callback that will be invoked by event bus
           The Event Bus invokes this function when it receives an event that has been identified
           as requiring sniffing. The component that implements the registered function should
           publish the event back to the Event Bus after it has been processed
           Note: In current implementation only one sniff handler is supported
    \param event_sniff_handler - the callback responsible for sniffing events
    \param publish_sniffed_event - the callback that must be invoked to publish the event back to the Event Bus
*/
void EventBus_RegisterEventSniffer(event_bus_sniffer_handler_t event_sniff_handler, event_bus_sniffer_handler_t *publish_sniffed_event);

/*! \brief Unregisters the callback that is responsible for sniffing events
    \param event_sniff_handler - the callback responsible for sniffing events
    \param publish_sniffed_event - the callback invoked to publish the event back to the Event Bus
*/
void EventBus_UnregisterEventSniffer(event_bus_sniffer_handler_t event_sniff_handler, event_bus_sniffer_handler_t *publish_sniffed_event);

/*! \brief Subscribe from an event bus channel.
           Note: Event Bus will fully consume the sniffer event data
    \param channel - the event bus channel to unsubscribe from.
    \param sniffer_events - array of events that need to be synchronised
    \param num_sniffer_events - number of events in array
    \param channel_handler - A function pointer to the channel handler that was previously used to subscribe.
*/
void EventBus_SubscribeSnifferEvents(event_bus_channel_t channel, const event_bus_event_t sniffer_events[], uint8 num_sniffer_events, event_bus_subscriber_t subscriber);

#endif// EVENT_BUS_SNIFFER_H

/*! @} */
